package com.southwind.common;

import com.southwind.entity.*;
import lombok.AllArgsConstructor;
import lombok.Data;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Data
public class ResultObj {

    public static Map resultData(List data,Long count){
        Map map = new HashMap();
        map.put("data", data);
        map.put("count", count);
        return map;
    }

    public final static ResultObj LOGIN_SUCCESS = new ResultObj(0, "登录成功");
    public final static ResultObj LOGIN_LOGINNAME_ERROR = new ResultObj(-1, "用户名错误");
    public final static ResultObj LOGIN_PASSWORD_ERROR = new ResultObj(-1, "密码错误");
    public final static ResultObj LOGIN_CODE_ERROR = new ResultObj(-1, "验证码错误");

    public final static ResultObj CUSTOMER_IDENTITY_ERROR = new ResultObj(-1,"身份证号已存在");
    public final static ResultObj CUSTOMER_ADD_SUCCESS = new ResultObj(0, "客户添加成功");
    public final static ResultObj CUSTOMER_ADD_ERROR = new ResultObj(-1, "客户添加失败");
    public final static ResultObj CUSTOMER_UPDATE_SUCCESS = new ResultObj(0, "客户编辑成功");
    public final static ResultObj CUSTOMER_UPDATE_ERROR = new ResultObj(-1, "客户编辑失败");
    public final static ResultObj CUSTOMER_DELETE_SUCCESS = new ResultObj(0, "客户删除成功");
    public final static ResultObj CUSTOMER_DELETE_ERROR = new ResultObj(-1, "客户删除失败");

    public final static ResultObj CAR_NUMBER_ERROR = new ResultObj(-1,"车牌号已存在");
    public final static ResultObj CAR_ADD_SUCCESS = new ResultObj(0, "车辆添加成功");
    public final static ResultObj CAR_ADD_ERROR = new ResultObj(-1, "车辆添加失败");
    public final static ResultObj CAR_UPDATE_SUCCESS = new ResultObj(0, "车辆编辑成功");
    public final static ResultObj CAR_UPDATE_ERROR = new ResultObj(-1, "车辆编辑失败");
    public final static ResultObj CAR_DELETE_SUCCESS = new ResultObj(0, "车辆删除成功");
    public final static ResultObj CAR_DELETE_ERROR = new ResultObj(-1, "车辆删除失败");

    public final static ResultObj NEWS_ADD_SUCCESS = new ResultObj(0, "公告添加成功");
    public final static ResultObj NEWS_ADD_ERROR = new ResultObj(-1, "公告添加失败");
    public final static ResultObj NEWS_UPDATE_SUCCESS = new ResultObj(0, "公告编辑成功");
    public final static ResultObj NEWS_UPDATE_ERROR = new ResultObj(-1, "公告编辑失败");
    public final static ResultObj NEWS_DELETE_SUCCESS = new ResultObj(0, "公告删除成功");
    public final static ResultObj NEWS_DELETE_ERROR = new ResultObj(-1, "公告删除失败");

    public final static ResultObj RENT_IDENTITY_ERROR = new ResultObj(-1, "身份证号不存在，请重新输入");
    public final static ResultObj RENT_ADD_SUCCESS = new ResultObj(0, "汽车租赁成功");
    public final static ResultObj RENT_ADD_ERROR = new ResultObj(-1, "汽车租赁失败");

    public final static ResultObj RENT_ID_ERROR = new ResultObj(-1, "出租单号不存在，请重新输入");
    public final static ResultObj RENT_CHECK_ERROR = new ResultObj(-1, "该车辆已入库，请勿重复入库");

    public final static ResultObj CHECK_ADD_SUCCESS = new ResultObj(0, "车辆入库成功");
    public final static ResultObj CHECK_ADD_ERROR = new ResultObj(-1, "车辆入库失败");

    public ResultObj(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public ResultObj(Integer code, Object data) {
        this.code = code;
        this.data = data;
    }

    public ResultObj(Object data, Long count) {
        this.data = data;
        this.count = count;
    }

    private Integer code;
    private String msg;
    private SysUser user;
    private Object data;
    private Long count;
    private BusRent rent;
    private BusCar car;
    private BusCustomer customer;
    private BusCheck check;

    public ResultObj(Integer code, BusRent rent, BusCar car, BusCustomer customer, BusCheck check) {
        this.code = code;
        this.rent = rent;
        this.car = car;
        this.customer = customer;
        this.check = check;
    }
}
